<template>
<div class="container">
  <van-nav-bar
      title="发布求购"
      left-text="返回"
      right-text="发布"
      left-arrow
      fixed
      @click-left="onClickLeft"
      @click-right="sendWantBuy"
  />
  <van-field
      v-model="message"
      rows="8"
      autosize
      type="textarea"
      maxlength="60"
      placeholder="请输入求购信息"
      show-word-limit
      :border="true"
  />
</div>
</template>

<script>
import {Toast} from "vant";

export default {
  name: "WantBuySend",
  data(){
    return{
      message:''

    }
  },
  methods:{
    sendWantBuy(){
      //发送请求添加求购
       this.$http.post('/WantBuy/sendWantBuy',{
         wantContent:this.message,
         nick_name:localStorage.getItem('nickname')?localStorage.getItem('nickname'):"韦小宝"
       }).then(res=>{
         if(res.data.code==0){
           Toast.success('发布成功');
           this.message=""
         }
       })
    },
    onClickLeft(){
      this.$router.back()
    }

  }
}
</script>

<style scoped lang="less">
.container{
  padding-top: 50px;
}

</style>
